#ifndef AVALON_BUFFERWRITER_HPP
#define AVALON_BUFFERWRITER_HPP
#include <boost/thread/mutex.hpp>
#include "Avalon/IO/Buffer.hpp"
#include "Avalon/IO/Writer.hpp"

namespace Avalon {
namespace IO {

  /*! \class BufferWriter
   *  \brief Writes to a Buffer.
   */
  class BufferWriter : public Writer {
    public:

      //! Constructs a BufferWriter.
      BufferWriter();

      virtual ~BufferWriter();

      //! Returns the Buffer being written to.
      const Buffer& GetBuffer() const;

      virtual void Write(const void* data, int size,
        Out<Threading::Async<void> > result);

      virtual void Write(const Buffer& data,
        Out<Threading::Async<void> > result);

    private:
      Buffer m_buffer;
  };
}
}

#endif // AVALON_BUFFERWRITER_HPP
